load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

package(
    default_visibility = [
        "//rs/crypto:__subpackages__",
        "//rs/crypto/internal:__subpackages__",
    ],
)

DEPENDENCIES = [
    # Keep sorted.
    "//packages/ic-secp256k1",
    "//rs/crypto/internal/crypto_lib/basic_sig/der_utils",
    "//rs/crypto/internal/crypto_lib/types",
    "//rs/crypto/secrets_containers",
    "//rs/types/types",
    "@crate_index//:base64",
    "@crate_index//:serde",
    "@crate_index//:serde_bytes",
    "@crate_index//:simple_asn1",
    "@crate_index//:zeroize",
]

MACRO_DEPENDENCIES = []

DEV_DEPENDENCIES = [
    # Keep sorted.
    "//rs/crypto/sha2",
    "//rs/crypto/test_utils/reproducible_rng",
    "@crate_index//:assert_matches",
    "@crate_index//:hex",
    "@crate_index//:rand",
    "@crate_index//:wycheproof",
]

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
    name = "ecdsa_secp256k1",
    srcs = glob(["src/**"]),
    aliases = ALIASES,
    crate_name = "ic_crypto_internal_basic_sig_ecdsa_secp256k1",
    proc_macro_deps = MACRO_DEPENDENCIES,
    version = "0.9.0",
    deps = DEPENDENCIES,
)

rust_test(
    name = "ecdsa_secp256k1_test",
    aliases = ALIASES,
    crate = ":ecdsa_secp256k1",
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_test_suite(
    name = "ecdsa_secp256k1_integration",
    srcs = glob(["tests/**/*.rs"]),
    aliases = ALIASES,
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = [":ecdsa_secp256k1"] + DEPENDENCIES + DEV_DEPENDENCIES,
)
